import Vue from "vue";

//引入vue-router组件并在vue中注册
import vueRouter from "vue-router";
Vue.use(vueRouter);

//引入vue-resource组件并在vue中注册
import vueResource from "vue-resource"
Vue.use(vueResource);

import App from "./App.vue";

//引入mint-ui组件并在vue中注册
import mint from "mint-ui";
Vue.use(mint);

//引入vue-preview组件并在vue中注册
import VuePreview from 'vue-preview';
Vue.use(VuePreview);

//引入css样式
import "mint-ui/lib/style.min.css";

//引入mui
import "./statics/mui/css/mui.min.css"

//引入全局样式
import  "./statics/less/base.less"

//引入moment.js插件来格式化日期
import moment from "moment"
//创建全局过滤器来格式化日期
Vue.filter("datefmt",(input,fmtStr) => moment(input).format(fmtStr));

//引入组件
import home from "./components/home.vue"
import shopcar from "./components/shopcar/car.vue"
import newslist from "./components/news/newslist.vue"
import newsinfo from "./components/news/newsinfo.vue"
import photoShare from "./components/photos/photoShare.vue"
import photoinfo from "./components/photos/photoinfo.vue"
import goodslist from "./components/goods/goodslist.vue"
import goodsinfo from "./components/goods/goodsinfo.vue"
import goodsdesc from "./components/goods/goodsdesc.vue"
import goodscomment from "./components/goods/goodscomment.vue"
import search from "./components/search.vue"


var router = new vueRouter({
    linkActiveClass: "mui-active",
    routes: [
        {
            path: "/", redirect: '/home'//默认跳转到首页
        },
        {
            path: '/home', component: home//跳转到首页
        },
        {
            path: '/shopcar', component: shopcar//跳转到购物车
        },
        {
            path:'/news/newslist',component:newslist//跳转到新闻列表
        },
        {
            path:'/news/newsinfo/:newsid',component:newsinfo//跳转到新闻详情页
        },
        {
            path:'/photos/photoShare',component:photoShare//跳转到图片分享
        },
        {
            path:'/photos/photoinfo/:imgid',component:photoinfo//跳转图片详情页
        },
        {
            path:'/goods/goodslist',component:goodslist//跳转到商品购买列表
        },
        {
            path:'/goods/goodsinfo/:goodsid',component:goodsinfo//跳转到商品详情列表
        },
        {
            path:'/goods/goodsdesc/:goodsid',component:goodsdesc//跳转到商品图文列表
        },
        {
            path:'/goods/goodscomment/:goodsid',component:goodscomment//跳转到商品图文列表
        },
        {
            path:'/search',component:search//跳转到搜索页面
        }
    ]
});

new Vue({
    el: '#app',
    router,
    render: c => c(App)
})
